<?php
namespace App\Modules\IntegralGoods;

use App\Modules\AdapterApi;
use App\Services\IntegralGoods\GoodsIndex;


/**
 * Class User 商品 应用层
 * @package App\Modules\Goods
 */
class Goods extends AdapterApi{

    /*艺货后台发布积分商品*/
    public function addIntegralGoods(): array 
    {
        $data = pick_array($this->postData, ['cate_id', 'title', 'integral', 'profile_pic', 'imgs_urls', 'imgs_ids', 'origin_number', 'order', 'desc', 'token']);
        return GoodsIndex::Goods()->addIntegralGoods($data);
    }

    /*后台修改积分商品*/
    public function updateIntegralGoods(): array
    {
        $data = pick_array($this->postData, ['id', 'cate_id', 'title', 'integral', 'profile_pic', 'imgs_urls', 'imgs_ids', 'number', 'origin_number', 'order', 'desc', 'token']);
        return GoodsIndex::Goods()->updateIntegralGoods($data);
    }

    /*艺货后台获取积分商品分页列表*/
    public function allGoodsList(): array
    {
        $data = pick_array($this->postData, ['keywords', 'page', 'listRows', 'token']);
        return GoodsIndex::Goods()->allGoodsList($data);
    }

    /*管理员下架某一个商品*/
    public function soldOutOneGoods(): array
    {
        $data = pick_array($this->postData, ['id', 'token']);
        return GoodsIndex::Goods()->soldOutOneGoods($data);
    }

    /*管理员下架某一批商品*/
    public function soldOutBatchGoods(): array
    {
        $data = pick_array($this->postData, ['id', 'token']);
        return GoodsIndex::Goods()->soldOutBatchGoods($data);
    }

    /*管理员删除商品*/
    public function manageDelGoods(): array
    {
        $data = pick_array($this->postData, ['id', 'token']);
        return GoodsIndex::Goods()->manageDelGoods($data);
    }

    /*管理员批量删除商品*/
    public function manageBatchDelGoods(): array
    {
        $data = pick_array($this->postData, ['id', 'token']);
        return GoodsIndex::Goods()->manageBatchDelGoods($data);
    }

}